/****** Object:  StoredProcedure [dbo].[spGetPhieuNhapListByDate]    Script Date: 09/30/2012 00:14:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[spGetPhieuNhapListByDate]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[spGetPhieuNhapListByDate]
GO

/****** Object:  StoredProcedure [dbo].[spGetPhieuNhapListByDate]    Script Date: 09/30/2012 00:14:04 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

create procedure [dbo].[spGetPhieuNhapListByDate]
		@tungay datetime,
		@denngay datetime	
WITH ENCRYPTION	
AS
	Begin
		Select *
		From tbl_PhieuNhap pn
		Where (@tungay is null) or (convert(date, @tungay) <= convert(date, pn.NgayNhapKho))
		  AND ((@denngay is null) or (convert(date, @denngay) >= convert(date, pn.NgayNhapKho)))
		Order by pn.NgayNhapKho asc
	End

GO


